var app = getApp()
Page({
  data: {
    listGroup: [{
      id: "1",
      category: "按国家",
      showAll: false,
      short: [{
          id: "1",
          name: "不限",
          selected: true,
        },
        {
          id: "2",

          name: "中国",

        },
        {
          id: "3",

          name: "中国",
          selected: false,

        },
        {
          id: "4",

          name: "中国",
          selected: false,

        },
        {
          id: "5",

          name: "中国",
        },
        {
          id: "6",

          name: "中国",
          selected: false,

        },
        {
          id: "7",

          name: "中国",
          selected: false,

        },
        {
          id: "8",

          name: "中国",
          selected: false,
        },
      ],
      all: [{
          id: "101",

          name: "不限",
          selected: true
        }, {
          id: "102",

          name: "中国",
          selected: false,

        },
        {
          id: "103",

          name: "中国",
          selected: false,

        },
        {
          id: "104",

          name: "中国",
          selected: false,

        },
        {
          id: "105",

          name: "中国",
          selected: false,

        },
        {
          id: "106",

          name: "中国",
          selected: false,

        },
        {
          id: "107",

          name: "中国",
          selected: false,

        },
        {
          id: "108",

          name: "中国",
          selected: false,

        },
        {
          id: "109",

          name: "中国",
          selected: false,

        },
        {
          id: "110",

          name: "中国",
          selected: false,

        },
        {
          id: "111",
          name: "日本",
          selected: false,

        },
        {
          id: "112",
          name: "印度",
          selected: false,

        },
        {
          id: "113",
          name: "印度",
          selected: false,

        },
        {
          id: "114",
          name: "韩国",
          selected: false,

        },
      ],
    }, 
      {
        id: "2",
        category: "按展区",
        showAll: false,
        short: [{
          id: "1",
          name: "不限",
          selected: true,
        },
        {
          id: "2",

          name: "中国",

        },
        {
          id: "3",

          name: "中国",
          selected: false,

        },
        {
          id: "4",

          name: "中国",
          selected: false,

        },
        {
          id: "5",

          name: "中国",
        },
        {
          id: "6",

          name: "中国",
          selected: false,

        },
        {
          id: "7",

          name: "中国",
          selected: false,

        },
        {
          id: "8",

          name: "中国",
          selected: false,
        },
        ],
        all: [{
          id: "101",

          name: "不限",
          selected: true
        }, {
          id: "102",

          name: "中国",
          selected: false,

        },
        {
          id: "103",

          name: "中国",
          selected: false,

        },
        {
          id: "104",

          name: "中国",
          selected: false,

        },
        {
          id: "105",

          name: "中国",
          selected: false,

        },
        {
          id: "106",

          name: "中国",
          selected: false,

        },
        {
          id: "107",

          name: "中国",
          selected: false,

        },
        {
          id: "108",

          name: "中国",
          selected: false,

        },
        {
          id: "109",

          name: "中国",
          selected: false,

        },
        {
          id: "110",

          name: "中国",
          selected: false,

        },
        ],
      }, 
      {
        id: "3",
        category: "按类别",
        showAll: false,
        short: [{
          id: "1",
          name: "不限",
          selected: true,
        },
        {
          id: "2",

          name: "建材",

        },
        {
          id: "3",

          name: "中国",
          selected: false,

        },
        {
          id: "4",

          name: "中国",
          selected: false,

        },
        {
          id: "5",

          name: "中国",
        },
        {
          id: "6",

          name: "中国",
          selected: false,

        },
        {
          id: "7",

          name: "中国",
          selected: false,

        },
        {
          id: "8",

          name: "中国",
          selected: false,
        },
        ],
        all: [{
          id: "101",

          name: "不限",
          selected: true
        }, {
          id: "102",

          name: "中国",
          selected: false,

        },
        {
          id: "103",

          name: "中国",
          selected: false,

        },
        {
          id: "104",

          name: "中国",
          selected: false,

        },
        {
          id: "105",

          name: "中国",
          selected: false,

        },
        {
          id: "106",

          name: "中国",
          selected: false,

        },
        {
          id: "107",

          name: "中国",
          selected: false,

        },
        {
          id: "108",

          name: "中国",
          selected: false,

        },
        {
          id: "109",

          name: "中国",
          selected: false,

        },
        {
          id: "110",

          name: "中国",
          selected: false,

        },
        ],
      }, 
      {
        id: "4",
        category: "厂商属性",
        showAll: false,
        short: [{
          id: "1",
          name: "不限",
          selected: true,
        },
        {
          id: "2",

          name: "建材",

        },
        {
          id: "3",

          name: "中国",
          selected: false,

        },
        {
          id: "4",

          name: "中国",
          selected: false,

        },
        {
          id: "5",

          name: "中国",
        },
        {
          id: "6",

          name: "中国",
          selected: false,

        },
        {
          id: "7",

          name: "中国",
          selected: false,

        },
        {
          id: "8",

          name: "中国",
          selected: false,
        },
        ],
        all: [{
          id: "101",

          name: "不限",
          selected: true
        }, {
          id: "102",

          name: "中国",
          selected: false,

        },
        {
          id: "103",

          name: "中国",
          selected: false,

        },
        {
          id: "104",

          name: "中国",
          selected: false,

        },
        {
          id: "105",

          name: "中国",
          selected: false,

        },
        {
          id: "106",

          name: "中国",
          selected: false,

        },
        {
          id: "107",

          name: "中国",
          selected: false,

        },
        {
          id: "108",

          name: "中国",
          selected: false,

        },
        {
          id: "109",

          name: "中国",
          selected: false,

        },
        {
          id: "110",

          name: "中国",
          selected: false,

        },
        ],
      }, 
    ],

  },
  submit: function() {
    this.setData({
      showModal: true
    })
  },
  onPullDownRefresh: function () {
    wx.stopPullDownRefresh({
      complete: (res) => { },
    });
  },
  preventTouchMove: function() {

  },


  go: function() {
    this.setData({
      showModal: false
    })
  },
  onLoad: function(options) {
    // 页面初始化 options为页面跳转所带来的参数

  },
  showAll: function(e) {
    var item = e.currentTarget.dataset.item || {};
    var listGroup = this.data.listGroup;
    for (var index in listGroup) {
      var group = listGroup[index];
      if(group.id == item.id)
      group.showAll = !item.showAll;
    }
    this.setData({
      listGroup: listGroup,
    });

  },
})